from typing import *


class Solution:

    def combine(self, n: int, k: int) -> List[List[int]]:
        ans = []

        def f(num, cur: list):
            if num > n:
                if len(cur) == k:
                    ans.append(cur.copy())
                return
            f(num + 1, cur)
            cur.append(num)
            f(num + 1, cur)
            cur.pop()

        f(1, [])
        return ans


so = Solution()
print(so.combine(4, 2))
